home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Python 1.1 / Doc / libselect.tex < prev    next >
LaTeX Document  |  1994-01-02  |  1.9 KB  |  [TEXT/R*ch]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: libselect.tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text, with CR line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[CR] default (weak)


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[R*ch]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 42 75 69 6c 74 2d 69 |\section|{Built-i|
|00000010| 6e 20 6d 6f 64 75 6c 65 | 20 5c 73 65 63 74 63 6f |n module| \sectco|
|00000020| 64 65 7b 73 65 6c 65 63 | 74 7d 7d 0d 5c 62 69 6d |de{selec|t}}.\bim|
|00000030| 6f 64 69 6e 64 65 78 7b | 73 65 6c 65 63 74 7d 0d |odindex{|select}.|
|00000040| 0d 54 68 69 73 20 6d 6f | 64 75 6c 65 20 70 72 6f |.This mo|dule pro|
|00000050| 76 69 64 65 73 20 61 63 | 63 65 73 73 20 74 6f 20 |vides ac|cess to |
|00000060| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 5c 63 6f |the func|tion \co|
|00000070| 64 65 7b 73 65 6c 65 63 | 74 7d 20 61 76 61 69 6c |de{selec|t} avail|
|00000080| 61 62 6c 65 20 69 6e 0d | 6d 6f 73 74 20 5c 55 4e |able in.|most \UN|
|00000090| 49 58 7b 7d 20 76 65 72 | 73 69 6f 6e 73 2e 20 20 |IX{} ver|sions. |
|000000a0| 49 74 20 64 65 66 69 6e | 65 73 20 74 68 65 20 66 |It defin|es the f|
|000000b0| 6f 6c 6c 6f 77 69 6e 67 | 3a 0d 0d 5c 72 65 6e 65 |ollowing|:..\rene|
|000000c0| 77 63 6f 6d 6d 61 6e 64 | 7b 5c 69 6e 64 65 78 73 |wcommand|{\indexs|
|000000d0| 75 62 69 74 65 6d 7d 7b | 28 69 6e 20 6d 6f 64 75 |ubitem}{|(in modu|
|000000e0| 6c 65 20 73 65 6c 65 63 | 74 29 7d 0d 5c 62 65 67 |le selec|t)}.\beg|
|000000f0| 69 6e 7b 65 78 63 64 65 | 73 63 7d 7b 65 72 72 6f |in{excde|sc}{erro|
|00000100| 72 7d 0d 54 68 65 20 65 | 78 63 65 70 74 69 6f 6e |r}.The e|xception|
|00000110| 20 72 61 69 73 65 64 20 | 77 68 65 6e 20 61 6e 20 | raised |when an |
|00000120| 65 72 72 6f 72 20 6f 63 | 63 75 72 73 2e 20 20 54 |error oc|curs. T|
|00000130| 68 65 20 61 63 63 6f 6d | 70 61 6e 79 69 6e 67 20 |he accom|panying |
|00000140| 76 61 6c 75 65 20 69 73 | 0d 61 20 70 61 69 72 20 |value is|.a pair |
|00000150| 63 6f 6e 74 61 69 6e 69 | 6e 67 20 74 68 65 20 6e |containi|ng the n|
|00000160| 75 6d 65 72 69 63 20 65 | 72 72 6f 72 20 63 6f 64 |umeric e|rror cod|
|00000170| 65 20 66 72 6f 6d 20 5c | 63 6f 64 65 7b 65 72 72 |e from \|code{err|
|00000180| 6e 6f 7d 20 61 6e 64 20 | 74 68 65 0d 63 6f 72 72 |no} and |the.corr|
|00000190| 65 73 70 6f 6e 64 69 6e | 67 20 73 74 72 69 6e 67 |espondin|g string|
|000001a0| 2c 20 61 73 20 77 6f 75 | 6c 64 20 62 65 20 70 72 |, as wou|ld be pr|
|000001b0| 69 6e 74 65 64 20 62 79 | 20 74 68 65 20 43 20 66 |inted by| the C f|
|000001c0| 75 6e 63 74 69 6f 6e 0d | 5c 63 6f 64 65 7b 70 65 |unction.|\code{pe|
|000001d0| 72 72 6f 72 28 29 7d 2e | 0d 5c 65 6e 64 7b 65 78 |rror()}.|.\end{ex|
|000001e0| 63 64 65 73 63 7d 0d 0d | 5c 62 65 67 69 6e 7b 66 |cdesc}..|\begin{f|
|000001f0| 75 6e 63 64 65 73 63 7d | 7b 73 65 6c 65 63 74 7d |uncdesc}|{select}|
|00000200| 7b 69 77 74 64 5c 2c 20 | 6f 77 74 64 5c 2c 20 65 |{iwtd\, |owtd\, e|
|00000210| 77 74 64 5c 2c 20 74 69 | 6d 65 6f 75 74 7d 0d 54 |wtd\, ti|meout}.T|
|00000220| 68 69 73 20 69 73 20 61 | 20 73 74 72 61 69 67 68 |his is a| straigh|
|00000230| 74 66 6f 72 77 61 72 64 | 20 69 6e 74 65 72 66 61 |tforward| interfa|
|00000240| 63 65 20 74 6f 20 74 68 | 65 20 5c 55 4e 49 58 7b |ce to th|e \UNIX{|
|00000250| 7d 20 5c 63 6f 64 65 7b | 73 65 6c 65 63 74 28 29 |} \code{|select()|
|00000260| 7d 0d 73 79 73 74 65 6d | 20 63 61 6c 6c 2e 20 20 |}.system| call. |
|00000270| 54 68 65 20 66 69 72 73 | 74 20 74 68 72 65 65 20 |The firs|t three |
|00000280| 61 72 67 75 6d 65 6e 74 | 73 20 61 72 65 20 6c 69 |argument|s are li|
|00000290| 73 74 73 20 6f 66 20 60 | 77 61 69 74 61 62 6c 65 |sts of `|waitable|
|000002a0| 0d 6f 62 6a 65 63 74 73 | 27 3a 20 65 69 74 68 65 |.objects|': eithe|
|000002b0| 72 20 69 6e 74 65 67 65 | 72 73 20 72 65 70 72 65 |r intege|rs repre|
|000002c0| 73 65 6e 74 69 6e 67 20 | 5c 55 4e 49 58 7b 7d 20 |senting |\UNIX{} |
|000002d0| 66 69 6c 65 20 64 65 73 | 63 72 69 70 74 6f 72 73 |file des|criptors|
|000002e0| 20 6f 72 0d 6f 62 6a 65 | 63 74 73 20 77 69 74 68 | or.obje|cts with|
|000002f0| 20 61 20 70 61 72 61 6d | 65 74 65 72 6c 65 73 73 | a param|eterless|
|00000300| 20 6d 65 74 68 6f 64 20 | 6e 61 6d 65 64 20 5c 63 | method |named \c|
|00000310| 6f 64 65 7b 66 69 6c 65 | 6e 6f 28 29 7d 20 72 65 |ode{file|no()} re|
|00000320| 74 75 72 6e 69 6e 67 0d | 73 75 63 68 20 61 6e 20 |turning.|such an |
|00000330| 69 6e 74 65 67 65 72 2e | 20 20 54 68 65 20 74 68 |integer.| The th|
|00000340| 72 65 65 20 6c 69 73 74 | 73 20 6f 66 20 77 61 69 |ree list|s of wai|
|00000350| 74 61 62 6c 65 20 6f 62 | 6a 65 63 74 73 20 61 72 |table ob|jects ar|
|00000360| 65 20 66 6f 72 20 69 6e | 70 75 74 2c 0d 6f 75 74 |e for in|put,.out|
|00000370| 70 75 74 20 61 6e 64 20 | 60 65 78 63 65 70 74 69 |put and |`excepti|
|00000380| 6f 6e 61 6c 20 63 6f 6e | 64 69 74 69 6f 6e 73 27 |onal con|ditions'|
|00000390| 2c 20 72 65 73 70 65 63 | 74 69 76 65 6c 79 2e 20 |, respec|tively. |
|000003a0| 20 45 6d 70 74 79 20 6c | 69 73 74 73 20 61 72 65 | Empty l|ists are|
|000003b0| 0d 61 6c 6c 6f 77 65 64 | 2e 20 20 54 68 65 20 6f |.allowed|. The o|
|000003c0| 70 74 69 6f 6e 61 6c 20 | 6c 61 73 74 20 61 72 67 |ptional |last arg|
|000003d0| 75 6d 65 6e 74 20 69 73 | 20 61 20 74 69 6d 65 2d |ument is| a time-|
|000003e0| 6f 75 74 20 73 70 65 63 | 69 66 69 65 64 20 61 73 |out spec|ified as|
|000003f0| 20 61 0d 66 6c 6f 61 74 | 69 6e 67 20 70 6f 69 6e | a.float|ing poin|
|00000400| 74 20 6e 75 6d 62 65 72 | 20 69 6e 20 73 65 63 6f |t number| in seco|
|00000410| 6e 64 73 2e 20 20 57 68 | 65 6e 20 74 68 65 20 5c |nds. Wh|en the \|
|00000420| 76 61 72 7b 74 69 6d 65 | 6f 75 74 7d 20 61 72 67 |var{time|out} arg|
|00000430| 75 6d 65 6e 74 0d 69 73 | 20 6f 6d 69 74 74 65 64 |ument.is| omitted|
|00000440| 20 74 68 65 20 66 75 6e | 63 74 69 6f 6e 20 62 6c | the fun|ction bl|
|00000450| 6f 63 6b 73 20 75 6e 74 | 69 6c 20 61 74 20 6c 65 |ocks unt|il at le|
|00000460| 61 73 74 20 6f 6e 65 20 | 66 69 6c 65 20 64 65 73 |ast one |file des|
|00000470| 63 72 69 70 74 6f 72 20 | 69 73 0d 72 65 61 64 79 |criptor |is.ready|
|00000480| 2e 20 20 41 20 74 69 6d | 65 2d 6f 75 74 20 76 61 |. A tim|e-out va|
|00000490| 6c 75 65 20 6f 66 20 7a | 65 72 6f 20 73 70 65 63 |lue of z|ero spec|
|000004a0| 69 66 69 65 73 20 61 20 | 70 6f 6c 6c 20 61 6e 64 |ifies a |poll and|
|000004b0| 20 6e 65 76 65 72 20 62 | 6c 6f 63 6b 73 2e 0d 0d | never b|locks...|
|000004c0| 54 68 65 20 72 65 74 75 | 72 6e 20 76 61 6c 75 65 |The retu|rn value|
|000004d0| 20 69 73 20 61 20 74 72 | 69 70 6c 65 20 6f 66 20 | is a tr|iple of |
|000004e0| 6c 69 73 74 73 20 6f 66 | 20 6f 62 6a 65 63 74 73 |lists of| objects|
|000004f0| 20 74 68 61 74 20 61 72 | 65 20 72 65 61 64 79 3a | that ar|e ready:|
|00000500| 0d 73 75 62 73 65 74 73 | 20 6f 66 20 74 68 65 20 |.subsets| of the |
|00000510| 66 69 72 73 74 20 74 68 | 72 65 65 20 61 72 67 75 |first th|ree argu|
|00000520| 6d 65 6e 74 73 2e 20 20 | 57 68 65 6e 20 74 68 65 |ments. |When the|
|00000530| 20 74 69 6d 65 2d 6f 75 | 74 20 69 73 20 72 65 61 | time-ou|t is rea|
|00000540| 63 68 65 64 0d 77 69 74 | 68 6f 75 74 20 61 20 66 |ched.wit|hout a f|
|00000550| 69 6c 65 20 64 65 73 63 | 72 69 70 74 6f 72 20 62 |ile desc|riptor b|
|00000560| 65 63 6f 6d 69 6e 67 20 | 72 65 61 64 79 2c 20 74 |ecoming |ready, t|
|00000570| 68 72 65 65 20 65 6d 70 | 74 79 20 6c 69 73 74 73 |hree emp|ty lists|
|00000580| 20 61 72 65 0d 72 65 74 | 75 72 6e 65 64 2e 0d 0d | are.ret|urned...|
|00000590| 41 6d 6f 6e 67 73 74 20 | 74 68 65 20 61 63 63 65 |Amongst |the acce|
|000005a0| 70 74 61 62 6c 65 20 6f | 62 6a 65 63 74 20 74 79 |ptable o|bject ty|
|000005b0| 70 65 73 20 69 6e 20 74 | 68 65 20 6c 69 73 74 73 |pes in t|he lists|
|000005c0| 20 61 72 65 20 50 79 74 | 68 6f 6e 20 66 69 6c 65 | are Pyt|hon file|
|000005d0| 0d 6f 62 6a 65 63 74 73 | 20 28 65 2e 67 2e 20 5c |.objects| (e.g. \|
|000005e0| 63 6f 64 65 7b 73 79 73 | 2e 73 74 64 69 6e 7d 2c |code{sys|.stdin},|
|000005f0| 20 6f 72 20 6f 62 6a 65 | 63 74 73 20 72 65 74 75 | or obje|cts retu|
|00000600| 72 6e 65 64 20 62 79 20 | 5c 63 6f 64 65 7b 6f 70 |rned by |\code{op|
|00000610| 65 6e 28 29 7d 0d 6f 72 | 20 5c 63 6f 64 65 7b 70 |en()}.or| \code{p|
|00000620| 6f 73 69 78 2e 70 6f 70 | 65 6e 28 29 7d 29 2c 20 |osix.pop|en()}), |
|00000630| 73 6f 63 6b 65 74 20 6f | 62 6a 65 63 74 73 20 72 |socket o|bjects r|
|00000640| 65 74 75 72 6e 65 64 20 | 62 79 0d 5c 63 6f 64 65 |eturned |by.\code|
|00000650| 7b 73 6f 63 6b 65 74 2e | 73 6f 63 6b 65 74 28 29 |{socket.|socket()|
|00000660| 7d 2c 20 61 6e 64 20 74 | 68 65 20 6d 6f 64 75 6c |}, and t|he modul|
|00000670| 65 20 5c 63 6f 64 65 7b | 73 74 64 77 69 6e 7d 20 |e \code{|stdwin} |
|00000680| 77 68 69 63 68 20 68 61 | 70 70 65 6e 73 20 74 6f |which ha|ppens to|
|00000690| 0d 64 65 66 69 6e 65 20 | 61 20 66 75 6e 63 74 69 |.define |a functi|
|000006a0| 6f 6e 20 5c 63 6f 64 65 | 7b 66 69 6c 65 6e 6f 28 |on \code|{fileno(|
|000006b0| 29 7d 20 66 6f 72 20 6a | 75 73 74 20 74 68 69 73 |)} for j|ust this|
|000006c0| 20 70 75 72 70 6f 73 65 | 2e 20 20 59 6f 75 20 6d | purpose|. You m|
|000006d0| 61 79 0d 61 6c 73 6f 20 | 64 65 66 69 6e 65 20 61 |ay.also |define a|
|000006e0| 20 5c 64 66 6e 7b 77 72 | 61 70 70 65 72 7d 20 63 | \dfn{wr|apper} c|
|000006f0| 6c 61 73 73 20 79 6f 75 | 72 73 65 6c 66 2c 20 61 |lass you|rself, a|
|00000700| 73 20 6c 6f 6e 67 20 61 | 73 20 69 74 20 68 61 73 |s long a|s it has|
|00000710| 20 61 6e 0d 61 70 70 72 | 6f 70 72 69 61 74 65 20 | an.appr|opriate |
|00000720| 5c 63 6f 64 65 7b 66 69 | 6c 65 6e 6f 28 29 7d 20 |\code{fi|leno()} |
|00000730| 6d 65 74 68 6f 64 20 28 | 74 68 61 74 20 72 65 61 |method (|that rea|
|00000740| 6c 6c 79 20 72 65 74 75 | 72 6e 73 20 61 20 5c 55 |lly retu|rns a \U|
|00000750| 4e 49 58 7b 7d 20 66 69 | 6c 65 0d 64 65 73 63 72 |NIX{} fi|le.descr|
|00000760| 69 70 74 6f 72 2c 20 6e | 6f 74 20 6a 75 73 74 20 |iptor, n|ot just |
|00000770| 61 20 72 61 6e 64 6f 6d | 20 69 6e 74 65 67 65 72 |a random| integer|
|00000780| 29 2e 0d 5c 65 6e 64 7b | 66 75 6e 63 64 65 73 63 |)..\end{|funcdesc|
|00000790| 7d 0d 5c 74 74 69 6e 64 | 65 78 7b 73 6f 63 6b 65 |}.\ttind|ex{socke|
|000007a0| 74 7d 0d 5c 74 74 69 6e | 64 65 78 7b 73 74 64 77 |t}.\ttin|dex{stdw|
|000007b0| 69 6e 7d 0d | |in}. | |
+--------+-------------------------+-------------------------+--------+--------+